#!/bin/sh

uci -q batch <<-EOF >/dev/null
	delete ucitrack.@kcptun[-1]
	add ucitrack kcptun
	set ucitrack.@kcptun[-1].init=kcptun
	commit ucitrack
EOF

general=$(uci -q get kcptun.@general[-1])

if [ -z "$general" ]; then
	uci -q add kcptun general
fi

if [ ."$general" != ."general" ]; then
	uci -q batch <<-EOF >/dev/null
		rename kcptun.@general[-1]="general"
		set kcptun.general.server=""
		commit kcptun
	EOF
fi

rm -rf /tmp/luci-indexcache /tmp/luci-modulecache
exit 0
